<HTML><HEAD><TITLE>mzn_run_string(++MznModel, ++SolverOrOptions)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(minizinc)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>mzn_run_string(++MznModel, ++SolverOrOptions)</H1>
Run a MiniZinc model given as a string or list
<DL>
<DT><EM>MznModel</EM></DT>
<DD>String, Atom or List of constants
</DD>
<DT><EM>SolverOrOptions</EM></DT>
<DD>Name of solver mapping module, or zn_options-structure
</DD>
</DL>
<H2>Description</H2>
<P>
	Solves the MiniZinc model MznModel, given in the simplest form
	as a string in MiniZInc syntax.  The problem is solved using
	a mapping to a concrete ECLiPSe solver, as specified in the
	SolverOrOptions argument.  Search and output are done according
	to the model's solve and output items.
    </P><P>
	Note that, because of the rules for escaping characters within
	ECLiPSe strings, any backslashes in the MiniZinc source have
	to be doubled, and double quotes must be escaped with a backslash!
    </P><P>
	Obviously, one would like to pass parameters into a model.  The
	model can therefore  be given as a list of strings in MiniZinc
	syntax, interleaved with ECLiPSe ground terms that serve as 
	parameter instantiations.  The actual MiniZinc model then
	consists of the concatenation of all these parts.
    </P>
<H3>Modes and Determinism</H3><UL>
<LI>mzn_run_string(++, ++) is det
</UL>
<H2>Examples</H2>
<PRE>
    ?- mzn_run_string("
		int: n = 8;
		array [1..n] of var 1..n: q;
		constraint
		    forall (i in 1..n, j in i+1..n) (
			q[i]     != q[j]     /\\
			q[i] + i != q[j] + j /\\
			q[i] - i != q[j] - j
		    );
		solve satisfy;
	    ", fzn_ic).

    Starting search
    q = [1,5,8,6,3,7,2,4]
    Total time 0.020s cpu (0.020 setup+ 0.000 search)
    Yes (0.02s cpu, solution 1, maybe more)


    ?- N=8, mzn_run_string(["
		int: n = ",
	    N, ";
		array [1..n] of var 1..n: q;
		constraint
		    forall (i in 1..n, j in i+1..n) (
			q[i]     != q[j]     /\\
			q[i] + i != q[j] + j /\\
			q[i] - i != q[j] - j
		    );
		solve satisfy;
	    "], fzn_ic).

    Starting search
    q = [1,5,8,6,3,7,2,4]
    Total time 0.020s cpu (0.020 setup+ 0.000 search)
    N = 8
    Yes (0.02s cpu, solution 1, maybe more)
&lt;/PRE&gt;
</PRE>
<H2>See Also</H2>
<A HREF="../../lib_public/minizinc/mzn_run-2.html">mzn_run / 2</A>, <A HREF="../../lib_public/minizinc/mzn_run-3.html">mzn_run / 3</A>, <A HREF="../../lib_public/flatzinc/zn_options-s.html">flatzinc : struct(zn_options)</A>
</BODY></HTML>
